home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************
- * ispCODE5A.c *
- * ispCODE for ispLSI Devices Using the Industry Standard ISP State Machine. *
- * Lattice Semiconductor Corp. Copyright 1996,1997. *
- * *
- * ISP(tm) daisy chain turbo programming is supported by ispCODE. *
- * *
- * The function of this ispCODE is to utilize the Industry Standard ISP state *
- * machine in the ispLSI devices for programming and verification. The input *
- * file for ispCODE is FULL ispSTREAM files or Super FULL ispSTREAM files. *
- * *
- * This version of ispCODE is the much simplified version of ispCODE V3.xx *
- * by removing the PES checking, the post BULK ERASE verification and the *
- * simultaneous shifting data in and out. The programming time is thus a bit *
- * longer than V3.xx due to the additional time needed to shift data in and *
- * out separately. It is a very little price to pay for a 50% reduction in *
- * code size which is especially critical for embedded controller programming *
- * where resources is extremely limited. *
- * *
- * The file size of Super FULL ispSTREAM is about 30% less than the FULL *
- * ispSTREAM. The saving comes from replacing long chain of 0xFFs with *
- * the number of consecutive 0xFF bytes. For example: *
- * 0xFF,0xFF,0xFF,0xC3 is reduced to 0xFF,0x03,0xC3 *
- * *
- * The Super FULL ispSTREAM file is created by the command line program *
- * dld2isp.exe v4.03 with the option sf selected. For example: type *
- * dld2isp design.dld sf *
- * *
- * All ispLSI devices support the Lattice Semiconductor pioneered UES *
- * feature. If the UES is appended into the JEDEC files using the UES editor *
- * on ISP Daisy Chain Download program, the resultant ispSTREAM will take *
- * care of programming and verifying the UES data. *
- * *
- * Note: The UES length of most ispLSI devices is the same as their data *
- * length. If it is found on the data book that they are not the same *
- * such as ispLSI 3256 and 6192 devices, only the last 160 bits are *
- * referred to as UES. For example: The data length of ispLSI 3256 *
- * devices is 338 bits and the UES length is 160 bits as shown in the *
- * data book. Pulse SCLK 338-160=178 times to flush out the phantum *
- * bits first then read the 1st UES bit. *
- * *
- * Revision history: *
- * 5A.000 Howard Tang 10/17/96 Convert from V5.1 to support ISP(tm) *
- * programming using the industry standard ISP*
- * state machine with the Super FULL *
- * ispSTREAM. *
- * 5A.001 Howard Tang 11/15/96 Change from ispSTREAM from file to *
- * ispSTREAM from ispstream[] array. *
- * 5A.002 Howard Tang 12/20/96 Add Read and Display UES option. *
- * 5A.003 Howard Tang 01/17/97 Update support for GDX devices. *
- *****************************************************************************/
-
- #include <stdio.h>
- #include <dos.h>
- #include <stdlib.h>
- #include <string.h>
- #include "lattice.h"
- #include "istream.hex" /*5a.001 convert to istream.hex from design.isp by
- isp2hex.exe*/
-
- /*Global variables */
- static short int bit=0; /*the current bit read from ispSTREAM*/
- static unsigned char curch; /*the current data from ispSTREAM*/
- unsigned char *fp; /*the pointer to the ispSTREAM array*/
- static short int inputport=inport1, /*port address for the input port*/
- outputport=outport1; /*port address for the output port*/
- static short int isp_pins=NUL; /*holds the value of parallel port*/
- /* intialized to drive all pins to LOW*/
-
- /*prototypes*/
- void pulse_width(unsigned short int milliseconds);
- void execute(void);
- void move_to_id_state(void);
- short int ispstream_pump(short int operation, short int *end);
- void error_handler(short int rcode, char *message);
- unsigned char GetByte(void);
- void ReadispSTREAMHeader(short int *ChainLength, short int *ErasePulse,
- short int *ProgramPulse, short int *RowLength,
- unsigned short int *DataSize,
- unsigned short int *IDStreamLength);
- char ispRead(unsigned short int DataSize, unsigned char *OutData);
- void ReadispSTREAMDataSize(unsigned short int *DataSize);
- void ReadispSTREAMData(unsigned short int *DataSize, unsigned char *InData,
- char SF);
- char ispInstruction(char SF,char Send);
- void ispData( unsigned char *InData, unsigned short int DataSize);
-
- /***************************************************************************
- Function: isp_setpin(byte pins, byte value)
-
- Purpose:
- To apply the specified value to the pins indicated. This routine will
- likely be modified for specific systems. As an example, this code
- is for the PC, as described below.
-
- This routine uses the IBM-PC standard Parallel port, along with the
- schematic shown in Lattice documentation, to apply the signals to the
- programming loop.
-
- PC Parallel port pin Signal name
- -------------------- -----------
- 2 out_SDI
- 3 out_SCLK
- 4 out_MODE
- 5 out_ISP
- 6 out_RESET
- 7 DO5
- 8 out_SENSE_CABLE_OUT
- 9 DO7
- 10 in_SDO
- 12 in_CABLE_SENSE_IN
- 15 in_VCC_OK
- 20 GND
-
- Parameters:
- - pins, which is actually a set of bit flags (defined in lattice.h)
- that correspond to the bits of the data port. Each of the I/O port
- bits that drives an isp programming pin is assigned a flag
- (through a #define) corresponding to the signal it drives. To
- change the value of more than one pin at once, the flags are added
- together, much like file access flags are.
-
- The bit flags are only set if the pin is to be changed. Bits that
- do not have their flags set do not have their levels changed. The
- state of the port is always manintained in the static global
- variable isp_pins, so that each pin can be addressed individually
- without disturbing the others.
-
- - value, which is either HIGH (0x01 ) or LOW (0x00 ). Only these two
- values are valid. Any non-zero number sets the pin(s) high.
-
- Returns: nothing.
-
-
- **************************************************************************/
- void isp_setpin(unsigned char pins, unsigned char value)
- {
- /* isp_pins is a Global value that keeps track of the current state
- of the pins */
-
- if( value ) /* set flagged pins HIGH */
- isp_pins = pins | isp_pins;
- else /* set flagged pins LOW */
- isp_pins = ~pins & isp_pins;
-
- /* value is put on Parallel port pins */
- outp(outputport, isp_pins);
-
- } /* isp_setpin() */
-
-
- /***************************************************************************
- Function: isp_SDO()
-
- Purpose:
- To get the value of the SDO pin from the input port.
-
- This routine is specific to the PC parallel port setup, but can easily
- be changed to address each user's hardware.
-
- Parameters: none
-
- Returns: The value of SDO, as a byte, with a value of either 0 or 1.
-
- Notes:
- - This routine uses the I/O port addresses contained in the global
- variable inputport, declared in the lattice.h file.
-
- ****************************************************************************/
- unsigned char isp_SDO(void)
- {
- /* MUST return either 0x00 or 0x01 */
- return( (unsigned char) ((inp(inputport) & in_SDO ) ? HIGH : LOW) );
-
- } /* isp_SDO() */
-
- /*************************************************************
- * *
- * PULSE_WIDTH *
- * This procedure produce accurate timing only on straight PC *
- * DOS. The timing is not guarantee if use on Windows DOS. *
- * The delay() function is available only from BORLAND. *
- * *
- * Users must devise their own timing procedures to ensure *
- * the specified minimum delay is observed when using *
- * different platform. *
- *************************************************************/
-
-
- void pulse_width(unsigned short int milliseconds)
- {
- delay(milliseconds);
- }
-
-
-
- /*************************************************************
- * *
- * GETBYTE *
- * This procedure reads a byte from the ispSTREAM. *
- *************************************************************/
- unsigned char GetByte()
- {
- /* return (fgetc(fp)); */
- return (*fp++);
- }
-
-
- /*************************************************************
- * *
- * SCLOCK *
- * This procedure apply a clock to TCK. *
- *************************************************************/
- void sclock(void)
- {
- isp_setpin(out_SCLK,HIGH);
- isp_setpin(out_SCLK,LOW);
- }
-
- /*************************************************************
- * *
- * SHIFT/EXECUTE *
- * *
- *************************************************************/
- void execute()
- {
- isp_setpin(out_MODE, HIGH);
- isp_setpin(out_SDI, HIGH);
- sclock();
- isp_setpin(out_SDI, LOW);
- isp_setpin(out_MODE, LOW);
- }
-
-
- /*************************************************************
- * *
- * MOVE TO ID STATE *
- * *
- *************************************************************/
-
- void move_to_id_state()
- {
- isp_setpin(out_SDI,LOW);
- isp_setpin(out_MODE, HIGH);
- isp_setpin(out_MODE, HIGH); /*extra delay for device to settle*/
- sclock();
- isp_setpin(out_MODE, LOW);
- }
-
-
- /**********************************************************************
- * *
- * READ_ISPSTREAM_HEADER *
- * Extract the header from the ispSTREAM file. *
- * Return *
- * ChainLength--------number of ispLSI devices in the *
- * given daisy chain. *
- * ErasePulse---------pulse width in mS for device *
- * bulk erase. *
- * ProgramPulse-------pulse width in mS for device *
- * row by row programming. *
- * RowLength----------the number of rows of data +UES *
- * DataSize-----------the largest size of each row of data. *
- * BEVend-------------the end of Bulk Erase verify. *
- ***********************************************************************/
- void ReadispSTREAMHeader(short int *ChainLength, short int *ErasePulse,
- short int *ProgramPulse, short int *RowLength,
- unsigned short int *DataSize,
- unsigned short int *BEVend)
- {
-
- *ChainLength = GetByte();
- *ErasePulse = GetByte() * 0x100;
- *ErasePulse += GetByte();
- *ProgramPulse = GetByte();
- *RowLength = GetByte() * 0x100;
- *RowLength += GetByte();
- *DataSize = GetByte() * 0x100;
- *DataSize += GetByte();
- *BEVend = GetByte() * 0x100;
- *BEVend += GetByte();
- /*End of the header of the ispSTREAM file.*/
-
- }
-
- /*********************************************************************
- * *
- * READ_ISPSTREAM_DATA_SIZE *
- * Extract the data size of the current row from the ispSTREAM file. *
- * Return *
- * DataSize-----------The data bit length of the current row. *
- **********************************************************************/
- void ReadispSTREAMDataSize(unsigned short int *DataSize)
- {
- short int index;
- unsigned short int temp;
- unsigned char xch;
-
- xch=0;
- temp = 0;
- for (index=0; index<16; index++)
- {--bit;
- if (bit<0)
- {
- curch = GetByte();
- bit=7;
- }
- if ((curch >> bit) & 0x01) xch |= 0x80 >> index%8;
- if (index%8==7) {temp = temp * 0x100 + xch; xch=0;}
- }
- *DataSize = temp;
- }
-
- /*****************************************************************
- * *
- * READ_ISPSTREAM_DATA *
- * Extract the data from the ispSTREAM file. *
- * SF-----------------Super FULL ispSTREAM file if true. *
- * Return *
- * DataSize-----------The number of data bits fetched. *
- * InData-------------The data stream from ispSTREAM file *
- ******************************************************************/
- void ReadispSTREAMData(unsigned short int *DataSize, unsigned char *InData,
- char SF)
- {
- unsigned short int index,size;
- short int j;
- unsigned char xch;
- short int FFcount=0;
-
- ReadispSTREAMDataSize(&size);
- if (size > 0) /*5a.003 retain the old size if the current row is NULL*/
- *DataSize = size;
- j=0;
- xch=0;
- for (index=0; index<size; index++)
- {--bit;
- if (bit<0)
- {if (FFcount<=0) /*5.1 Read a new byte if 0xFF chain exhausted*/
- { curch = GetByte();
- if ((SF)&&(curch==0xFF)) /*Super FULL ispSTREAM file support*/
- FFcount = GetByte(); /*The number of 0xFF bytes*/
- }
- else FFcount--; /*Use up the 0xFF chain first*/
- bit=7;
- }
- if ((curch >> bit) & 0x01) xch |= 0x80 >> index%8;
- if (index%8==7) {InData[j++] = xch; xch=0;}
- }
- if (size > 0) InData[j] = xch; /*save the last byte of the current row*//*5a.003*/
- }
-
- /*****************************************************************
- * *
- * ispInstruction *
- * Extract the instruction from the ispSTREAM file and clock into *
- * the devices or throw away. *
- * SF-----------------Super FULL ispSTREAM file if true. *
- * Send---------------Send data to devices if true. *
- * Return *
- * NONE *
- ******************************************************************/
- char ispInstruction(char SF, char Send)
- {
- short int index;
- short int i;
- unsigned short int size;
- short int FFcount=0;
-
- ReadispSTREAMDataSize(&size);
- for (index=0; index<size; index++)
- {--bit;
- if (bit<0)
- {if (FFcount<=0) /*5.1 Read a new byte if 0xFF chain exhausted*/
- { curch = GetByte();
- if ((SF)&&(curch==0xFF)) /*Super FULL ispSTREAM file support*/
- FFcount = GetByte(); /*The number of 0xFF bytes*/
- }
- else FFcount--; /*Use up the 0xFF chain first*/
- bit=7;
- }
- if (Send) /*send the data to the devices*/
- {isp_setpin(out_SDI,(curch >> bit) & 0x01);
- sclock(); /*clock the data into the command registers */
- }
- }
- if ((Send)&&(size > 0))
- {execute(); /*execute the instruction if sent*/
- return (1); /*signify data or instruction has actually sent*/
- }
- else return (0); /*no data or instruction send to the devices*/
- }
-
- /**********************************************************************
- * *
- * ispData *
- * Send the data stream to devices. *
- * InData-----------The data stream to be sent to devices. *
- * DataSize---------The length of the data stream. *
- ***********************************************************************/
- void ispData(unsigned char *InData,unsigned short int DataSize)
- {
- unsigned short int index;
- short int j;
- unsigned char curch;
-
- j=0;
- for (index = 0; index <DataSize; index++) {
- if (index%8==0) curch = InData[j++];
- isp_setpin(out_SDI, (((curch << index%8) & 0x80) ? 0x01 : 0x00));
- sclock(); /*clock data into the data shift registers */
- }
- if (DataSize > 0) execute(); /*step to shift state*//*5a.003*/
- }
-
- /**********************************************************************
- * *
- * ispRead *
- * Read the data stream from devices and verify. *
- * DataSize---------The length of the data stream. *
- * OutData----------The data stream to be compare with those read *
- * from devices. *
- ***********************************************************************/
- char ispRead(unsigned short int DataSize, unsigned char *OutData)
- {
- unsigned short int index,error;
- unsigned char xch,cur_bit;
- short int j;
-
- j=0;
- error=0;
- xch=0;
- for (index = 0; index <DataSize; index++) {
- if (index%8==0) xch = OutData[j++];
- cur_bit=isp_SDO();
- if (cur_bit != (((xch << index%8) & 0x80) ? 0x01 : 0x00)) error++;
- sclock(); /*clock data out from the data shift registers */
- }
- execute(); /*step to shift state*/
- if (error > 0) return 1; /*Flag failure occur*/
- else return (OK);
- }
-
-
- /**********************************************************************
- * *
- * ispDisplay *
- * Read the data stream from devices and display *
- * DataSize---------The length of the data stream. *
- * OutData----------The data stream read from devices. *
- * *
- * This function is for reading and displaying the UES of the ispLSI *
- * devices. If the JEDEC file of the ispLSI devices containing UES *
- * data, the UES data in the ispLSI devices will be read and displayed *
- * when calling this function. For example: *
- * 1032E pv 1032e.jed *
- * 2096 pv 2096.jed *
- * 3256A pv 3256a.jed *
- * If only the JEDEC files 1032e.jed and 2096.jed files have UES data *
- * then the UES data of 1032E and 2096 will be read and displayed as a *
- * continuous UES string. Please note that the UES of ispGAL22v10 and *
- * ispGDS can't supported by this function due to the fact that the UES*
- * are part of the ARRAY of those devices. Please also note that the *
- * actual length of UES row can be longer than what is published. *
- * For example: The UES row of 3256a is actually 338 bits long whereas *
- * the published UES length is 160. The extra bits are filled with 1s *
- * by the ispSTREAM writter. This function can read and display only *
- * the full length of the UES row. It can't mask out the dummy bits. *
- * It is strongly recommended that only one device is selected in a *
- * time in a daisy chain for reading and displaying UES. *
- ***********************************************************************/
- char ispDisplay(unsigned short int DataSize, unsigned char *OutData)
- {
- unsigned short int index;
- unsigned char xch,cur_bit;
- unsigned short int j;
- j=0;
- xch=0;
- for (index = 0; index <DataSize; index++) {
- cur_bit=isp_SDO();
- if (cur_bit) xch |= (0x80 >> index%8);
- if (index%8==7) {OutData[j++] = xch;
- xch=0;}
- sclock(); /*clock data out from the data shift registers */
- }
- OutData[j] = xch; /*store the last byte*/
- printf("\nThe UES string in HEX:\n");
- for (index = 0; index < DataSize/8; index++)
- printf("%02x",OutData[index]);
- printf("\nThe UES string in ASCII:\n");
- for (index = 0; index < DataSize/8; index++)
- {if (isprint(OutData[index])) printf("%c",OutData[index]);
- else printf(".");
- }
- printf("\n");
- execute(); /*step to shift state*/
- return (OK);
- }
-
- /*************************************************************
- * *
- * ISPSTREAM_PUMP *
- * *
- *************************************************************/
-
- short int ispstream_pump(short int operation, short int *end)
- {
- register short int row;
- char SF; /*ispSTREAM file types identifier*/
- char send; /*send data to devices if true*/
- char ready; /*5a.003 ready to verify data*/
- unsigned char FileType;
- short int last_row,
- erase_pulse,
- program_pulse,
- devices_in_chain;
- unsigned short int maxi_data,
- data_length,
- be_row;
- short int rcode,condition;
- unsigned char *buf;
-
- row =0;
- bit = 0;
- /*Start reading the header of the ispSTREAM */
- fp = ispstream; /*5a.1 point to the ispSTREAM*/
- FileType = GetByte();
- if (FileType == 0x0F) {SF=false;} /*Check for correct file type*/
- else if (FileType == 0x0a ) {SF=true;} /*Super FULL ispSTREAM file found*/
- else {
- return FILE_NOT_JEDEC;
- }
- ReadispSTREAMHeader(&devices_in_chain, &erase_pulse, &program_pulse,
- &last_row, &maxi_data, &be_row);
-
- rcode = OK; /*Success by default.*/
- if ((operation==verify)||
- (operation==verify_ues)||
- (operation==read_show_ues)) /*verify only*/
- {erase_pulse=0; /*void the erase instruction*/
- program_pulse=0; /*void the program instruction*/
- }
-
- /*Allocate memory to store one row of data from the ispSTREAM file.*/
- buf = buffer; /*5a.1 use the array declared in istream.hex*/
-
- /*set the initial condition of the parallel port*/
- /* All the port_pins defined on lattice.h will be controlled by
- ispstream_pump(). The rest can be initialized here either to
- HIGH or LOW and won't be altered by isptream_pump*/
-
- isp_pins = NUL; /* intialize to drive all port pins LOW*/
- isp_setpin(out_ISP, LOW);/* drive ispEN pin low to enable the
- ISP controlling pins:
- SCLK,MODE,SDI and SDO.*/
- move_to_id_state(); /* Go to Idle state*/
- execute(); /* synchronize the ISP state machine*/
- move_to_id_state(); /*Load the IDs*/
- ReadispSTREAMData(&data_length,buf,SF); /*fetch ID stream from ispSTREAM*/
- rcode = ispRead(data_length,buf); /*verify the ID stream*/
- if (rcode != OK)
- {
- return UNKNOWN_CHIP;
- }
- for (row=1; row<be_row; row++)
- {switch(row)
- { case 8: if (erase_pulse > 0) /*erase the devices*/
- {
- ispInstruction(SF,true);
- sclock(); /*start the erase timing*/
- pulse_width(erase_pulse); /*erase pulse*/
- isp_setpin(out_MODE, HIGH);
- isp_setpin(out_SDI,HIGH);
- pulse_width(1); /*super voltage discharge*/
- sclock();
- isp_setpin(out_SDI,LOW);
- isp_setpin(out_MODE,LOW); /*devices in shift state*/
- }
- else ispInstruction(SF,false); /*skipp BULK ERASE*/
- break;
- default:if (((row-9)%12==3)||((row-9)%12==8)) /*skipp BULK ERASE verify*/
- ReadispSTREAMDataSize(&data_length);
- else ispInstruction(SF,false);
- break;}
- }
- /*start processing the rows in the ispSTREAM file*/
- data_length = 0;
- for (; row <= last_row; row++) {
- *end = row; /* The row number where process ended.*/
- if (row==last_row) condition = 8; /* security programming*/
- else condition = (row-9) % 12;
- if (((operation==verify_ues)||(operation==read_show_ues))
- &&(row <= last_row-DATAROW)) send = false;
- else send = true;
- switch(condition){
- case 0: /*address shift*/
- case 1:ispInstruction(SF,send); /*address data*/
- break;
- case 2: /*data shift*/
- case 7:ready=ispInstruction(SF,send); /*5a.003 data shift*/
- break;
- case 3: /*shift data in/out of devices*/
- case 8:
- if ((data_length > 0)&&(ready)) /*5a.003 verify the data shifted in*/
- {rcode = ispRead(data_length,buf);
- execute(); /*back to execute state*/
- data_length=0; /*5a.003 data verified*/
- }
- ReadispSTREAMData(&data_length,buf,SF); /*fetch data stream from ispSTREAM*/
- if (ready) ispData(buf,data_length); /*send data into devices*/
- break;
- case 4:
- case 9:if (program_pulse > 0) /*program and verify*/
- {
- if (ispInstruction(SF,true)) /*5a.003 program commands exist*/
- {sclock(); /*start program timing*/
- pulse_width(program_pulse);
- execute(); /*step to shift state*/
- }
- }
- else ispInstruction(SF,false); /*skip programming*/
- break;
- case 5:
- case 10:if(ispInstruction(SF,send)) /*verify*/
- {sclock(); /*start verify timing*/
- pulse_width(1); /*30uS min. verify time*/
- execute(); /*step to shift state*/
- }
- break;
- case 6:
- case 11:if (ispInstruction(SF,send))
- {
- if (operation==read_show_ues) /*5A.002 read and display ues*/
- rcode = ispDisplay(data_length,buf);
- else
- rcode = ispRead(data_length,buf); /*verify the data stream*/
- data_length=0; /*don't verify again*/
- }
- break;
- default:break;
- }
- if (rcode != OK)
- {
- return VALIDATION_ERROR;
- }
- }
-
- move_to_id_state(); /*activate the ispGAL and ispGDS devices*/
- isp_setpin(out_ISP,HIGH); /*activate the ispLSI devices*/
- return (OK);
-
- }
-
-
- /*************************************************************
- * *
- * error_handler *
- * *
- * rcode - error code *
- * *
- * *
- * This procedure return the address of the message string *
- * for the corresponding error code. *
- * *
- *************************************************************/
-
- void error_handler(short int rcode, char *message)
- {
-
- char *error_message[] = {{"PASS"},{""},{""},{"PC Hardware Problem"},{""},
- {""},{""},
- {"No Device Found/Open Download Cable/Open Daisy Chain"},
- {"Can't Find the File"},{""},{"Not Enough PC Memory"},
- {"Verification Fail"},{""},{""},
- {""},
- {"The Chip Count in the Chain and the File Do Not Match"},
- {"Unknown Device Found"},{"Wrong File Type"},{"File Error"},
- {""}};
-
- strcpy(message, error_message[-rcode]);
- }
-
-
- /*************************************************************
- * *
- * MAIN *
- * *
- *************************************************************/
-
- short int main(int argc, char *argv[])
- {
- short int rcode = OK,
- end = 0;
- char str[300];
- short int operation=prog_verify; /*Default to Program and Verify*/
-
- printf("\n Lattice Semiconductor Corp.\n");
- printf("\n ispCODE V5A.003 Copyright 1996,1997.\n");
- printf("\n ispSTREAM Driver for ispLSI Devices\n");
- printf("\n For Daisy Chain of All ISP Devices On LSC ISP Controller\n\n");
-
- if ((argc < 1) || (argc > 2)) {
- printf("\nUsage: sturbo [operation]\n");
- printf("Example: sturbo pv\n");
- printf("\n");
- printf("operation \"pv\" = Program and verify\n");
- printf(" \"v\" = Verify only\n");
- printf(" \"uv\" = Verify UES only\n");
- printf(" \"ud\" = Read and display UES from devices.\n");
- printf(" Default to pv if operation is not entered.\n");
- exit(1);
- }
-
- if (rcode == OK){ /*start programming and verification*/
-
- if(!strcmp(strlwr(argv[1]),"uv")){ /*3.05 What to do? uv=ues verify only*/
- operation=verify_ues; /*for verify ues only =1*/
- printf("\nStart Verify UES of ispLSI devices.......\n");}
- else if(!strcmp(strlwr(argv[1]),"ud")){ /*v = verify only*/
- operation=read_show_ues;
- printf("\nStart Read and Display UES of ispLSI devices .......\n");}
- else if(!strcmp(strlwr(argv[1]),"v")){ /*v = verify only*/
- operation=verify;
- printf("\nStart Verify.......\n");}
- else { /*pv = program and verify: Default*/
- operation=prog_verify;
- printf("\nStart Program and Verify.......\n");
- }
-
- rcode = ispstream_pump(operation, &end); /*3.05 add operation switch*/
- }
- if (rcode != OK) {
- error_handler(rcode, str);
- printf("\nFailed At Row %d in Program and Verify Due To %s\n", end, str);
- printf("\n");
- printf("+-------+\n");
- printf("| FAIL! |\n");
- printf("+-------+\n");
- return (-rcode);
- } else {
- printf("\n");
- printf("+=======+\n");
- printf("| PASS! |\n");
- printf("+=======+\n");
- }
-
- return(0);
- }